home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_368 / listwindow / listwin_pak.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  5KB  |  103 lines

  1. /***************************************************************************
  2.  * listwin_pak.h -general-purpose dynamic list-window functions to make    *
  3.  *                programming alot easier.                                 *
  4.  *                (c) 1990 by VIDEOWORKS Computer Applications             *
  5.  *                All rights reserved.                                     *
  6.  *                129 Orchard Avenue, Rocky Mount, VA 24151                *                                         *
  7.  *                (703) 483-8219 / 489-3863                                *
  8.  *                                                                         *
  9.  *                Designed and Developed by Paul T. Miller                 *
  10.  *                                                                         *
  11.  * Program Name:  N/A                                                      *
  12.  * Version:       1                                                        *
  13.  * Revision:      0                                                        *
  14.  *-------------------------------------------------------------------------*
  15.  * File: (listwin_pak.h) dynamic list-window package header file           *
  16.  *-------------------------------------------------------------------------*
  17.  * Modification History                                                    *
  18.  * Date     Author   Comment                                               *
  19.  * -------- ------   -------                                               *
  20.  * 06-13-90    PTM   Created. ListWindow structure
  21.  * 06-22-90    PTM   NameList structure
  22.  * 06-23-90    PTM   Make NameList dynamically allocated
  23.  ***************************************************************************/
  24.  
  25. #ifndef LISTWIN_PAK_H
  26. #define LISTWIN_PAK_H
  27.  
  28. /* HandleListWindow() return codes */
  29. #define CLOSE_LISTWINDOW   -1
  30. #define LISTWINDOW_NONE    0
  31. #define GOT_NAME           1
  32.  
  33.  
  34. /* NameList structure - keeps track of pointers to text strings */
  35. struct NameList {
  36.    ULONG             Names;
  37.    ULONG             MaxNames;
  38.    UBYTE           **NamePtrs;
  39. };
  40. #define NAMELIST_SIZE   (sizeof(struct NameList))
  41.  
  42. /* ListWindow structure - keeps track of list information */
  43. struct ListWindow {
  44.    struct Window    *Window;     /* pointer to container window */
  45.    struct Gadget    *UpGad;      /* pointer to this window's UP gadget */
  46.    struct Gadget    *DownGad;    /* pointer to this window's DOWN gadget */
  47.    struct Gadget    *PropGad;    /* pointer to this window's SCROLL gadget */
  48.    struct NameList  *NameList;   /* pointer to the NameList structure */
  49.    USHORT            SlotWidth;  /* width of name slot */
  50.    USHORT            SlotHeight; /* height of name slot */
  51.    USHORT            NameWidth;  /* maximum name width (in pixels) */
  52.    SHORT             TotalNames; /* total number of names */
  53.    SHORT             VisibleNum; /* visible # of names (also # of gadgets) */
  54.    SHORT             TopNum;     /* number of top name visible */
  55.    SHORT             Overlap;    /* # to overlap "paged" scroll of list */
  56.    SHORT             Hidden;     /* # of names that don't fit in window */
  57.    SHORT             Selected;   /* # of selected name */
  58. };
  59. #define LISTWINDOW_SIZE (sizeof(struct ListWindow))
  60.  
  61. /* listwin.c function prototypes */
  62. int InitListWindowPackage(void);
  63. void CloseListWindowPackage(void);
  64.  
  65. struct Window *OpenListWindow(struct NewWindow *);
  66. int MakeListWindow(struct Window *);
  67. void CloseListWindow(struct Window *);
  68. void FreeListWindow(struct Window *);
  69. int AllocateListWinGads(struct ListWindow *);
  70. void FreeListWinGads(struct ListWindow *);
  71.  
  72. int InitListWindow(struct Window *, UBYTE **, SHORT, SHORT);
  73. void SetListWindowNameList(struct Window *, struct NameList *, SHORT);
  74. void SetNameListPos(struct Window *, SHORT);
  75. void SetListWindowPropGad(struct ListWindow *);
  76. UWORD GetListWindowPropValue(struct Window *);
  77.  
  78. int HandleListWindow(struct IntuiMessage *, UBYTE *);
  79. SHORT HandleListWindowRawKey(struct Window *, USHORT, USHORT, APTR);
  80. SHORT HandleListWindowKey(struct Window *, UBYTE);
  81. SHORT HandleListWindowGadgetDown(struct Window *, struct Gadget *, USHORT);
  82. SHORT GetListNameSlot(struct Window *, SHORT, SHORT);
  83.  
  84. LONG ConvertRawKey(USHORT, USHORT, APTR, UBYTE *, USHORT);
  85. void ResizeListWindow(struct Window *);
  86.  
  87. struct NameList *AllocateNameList(SHORT);
  88. void FreeNameList(struct NameList *);
  89. int AllocateNameListPtrs(struct NameList *, ULONG);
  90. void FreeNameListPtrs(struct NameList *);
  91. int ResizeNameList(struct NameList *, ULONG);
  92. void SetNameList(struct NameList *, UBYTE **, ULONG);
  93. void SortNameList(struct NameList *);
  94. void AddName(struct NameList *, UBYTE *);
  95. void RemoveName(struct NameList *, UBYTE *);
  96. void AddListWindowName(struct Window *, UBYTE *);
  97. void RemoveListWindowName(struct Window *, UBYTE *);
  98. void SelectListWindowName(struct Window *, UBYTE *);
  99. void SortListWindowNames(struct Window *);
  100.  
  101. #endif   /* LISTWIN_PAK_H */
  102.  
  103.